#include <iostream>
#include <Windows.h>
//#include <unistd.h>
#include "ai.h"
//#include "gameboard.h"

int main()
{
	Gameboard game;
	game.setup();
	char r;
	char c;
	short row;
	short column;
	bool valid;
	bool black = true;
	int ipip=0;
	cout << "O = White" << endl
		 << "@ = Black" << endl
		 << "* = Availble moves" << endl;
		 
	game.showNextPos();
	game.display();


	while (true)
	{
		Best test1;
		Best test;
		while(game.currentColor() == '@')
		{
			cout << game.currentColor() << "'s turn" << endl << endl;
			cout << endl << "AI IS THINKING..." << endl;
			test.chooseMove(black, 0, game,0,0,5);
				Sleep(100);
				game.move((int)test.row,(int)test.column);
				game.showNextPos();
				game.display();
				ipip=test.count_num_moves(game);

			
		}
		
		while(game.currentColor() == 'O')
		{
			cout << game.currentColor() << "'s turn" << endl << endl;
			cout << endl << "AI IS THINKING..." << endl;
			test1.chooseMove(black, 0, game,0,0,1);
				Sleep(100);
				game.move((int)test1.row,(int)test1.column);
				game.showNextPos();
				game.display();
		
				ipip=ipip+test1.count_num_moves(game);
		}
		if(ipip==0)
			game.gameOver();
	}	
}
